{include file="header"}
<div class="x-nav">
    <a>
        <cite style="font-size: 18px;">{:lang("user.roles")}</cite></a>
    </span>
    <a class="layui-btn layui-btn-small" href="/" style="line-height:1.6em;margin-top:3px;float:right" title="返回主页">
        <i class="layui-icon" style="line-height:30px">返回主页</i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">
                    <button class="layui-btn" onclick="parent.xadmin.open('{:lang('add')}{:lang('roles')}','{:url("user/rolesadd")}')"><i class="layui-icon"></i>{:lang("add")}</button>
                </div>
                <div class="layui-card-body">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>{:lang('roles')}{:lang("name")}</th>
                            <th>{:lang('roles')}{:lang('desc')}</th>

                            <th>{:lang('action')}</th>
                        </tr>
                        </thead>
                        <tbody>
                        {volist name="lists" id="item"}
                        <tr class="tr_{$item.id}">
                            <td>{$item.id}</td>
                            <td>{$item.name}</td>
                            <td>{$item.desc}</td>
                            <td>
                                <a href="javascript:;" class="rnglj" onclick="xadmin.open('{:lang("user.rolesedit")}','{:url("user/rolesedit",["id"=>$item["id"]])}')">{:lang('edit')}</a>
                                <a href="javascript:;" class="rnglj" onclick="del('{$item.id}')">{:lang('del')}</a>
                            </td>
                        </tr>
                        {/volist}
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    {$lists|raw}
                </div>
            </div>
        </div>
    </div>
</div>

{include file="footer"}
<script>
    function del(id) {
        layer.confirm("{:lang('del.confirm')}",{icon: 3, title:'{:lang('tips')}'},function (index) {
            layer.close(index);
            request("POST",'{:url("user/rolesdel")}',{
                id:id
            },function (res) {
                $(`.tr_${id}`).remove()
            })

        })
    }

</script>